package cn.pugle.base.collect;

import java.util.PriorityQueue;

/**
 * @author tzp
 * @since 2020/10/27
 */
public class HeapApp {
    public static void main(String[] args) {
        PriorityQueue<Integer> heap = new PriorityQueue<Integer>();
        heap.offer(3);
        heap.offer(1);
        heap.offer(2);

        while (heap.size() > 0) {
            System.out.println(heap.poll());
        }
//        for (Integer integer : heap) {//这么遍历的顺序不对
//            System.out.println(integer);
//        }

    }
}
